package cn.socialcredits.activity.data.driver

import javax.inject.Singleton

import cn.socialcredits.activity.setting.Settings
import reactivemongo.api.MongoDriver
import reactivemongo.api.collections.bson.BSONCollection

import scala.concurrent.ExecutionContext

@Singleton
class MyDriver {
  private val driver = new MongoDriver()

  private val connection = driver.connection(List(Settings.mongo.host))

  private def db(implicit ex: ExecutionContext) = connection.db(Settings.mongo.dbName)

  def collActivity(implicit ex: ExecutionContext) = db.collection[BSONCollection]("activity")

  def collActivityRegistration(implicit ex: ExecutionContext) = db.collection[BSONCollection]("activityRegistration")
}
